// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   SET_TELImpl.java

package com.sunwayhorizo.health.hl7.datatypes.common;

import com.sunwayhorizo.health.hl7.datatypes.ANY;
import com.sunwayhorizo.health.hl7.datatypes.BL;
import com.sunwayhorizo.health.hl7.datatypes.CS;
import com.sunwayhorizo.health.hl7.datatypes.SET_TEL;
import com.sunwayhorizo.health.hl7.datatypes.TEL;
import com.sunwayhorizo.health.hl7.datatypes.TYPE;

import java.util.Set;


// Referenced classes of package oracle.apps.ctb.hl7.types.common:
//            SETCommonImpl, ANYImpl, BLImpl, CSImpl, 
//            TYPEImpl

public class SET_TELImpl extends SETCommonImpl
    implements SET_TEL
{

    public static final String RCS_ID = "$Header: SET_TELImpl.java 115.14 2005/09/16 09:22:43 amchanda noship $";
    private static final SET_TEL nullNI = new SET_TELImpl(CSImpl.valueOf("NI"));
    private static final SET_TEL nullOTH = new SET_TELImpl(CSImpl.valueOf("OTH"));
    private static final SET_TEL nullNINF = new SET_TELImpl(CSImpl.valueOf("NINF"));
    private static final SET_TEL nullPINF = new SET_TELImpl(CSImpl.valueOf("PINF"));
    private static final SET_TEL nullUNK = new SET_TELImpl(CSImpl.valueOf("UNK"));
    private static final SET_TEL nullASKU = new SET_TELImpl(CSImpl.valueOf("ASKU"));
    private static final SET_TEL nullNAV = new SET_TELImpl(CSImpl.valueOf("NAV"));
    private static final SET_TEL nullMSK = new SET_TELImpl(CSImpl.valueOf("MSK"));
    private static final SET_TEL nullNA = new SET_TELImpl(CSImpl.valueOf("NA"));
    private static final SET_TEL nullNASK = new SET_TELImpl(CSImpl.valueOf("NASK"));

    public static SET_TEL valueOf(TEL atel[])
    {
        return new SET_TELImpl(atel);
    }

    public static SET_TEL valueOf(TEL tel)
    {
        return new SET_TELImpl(tel);
    }

    public static SET_TEL valueOf(Set set)
    {
        return new SET_TELImpl(set);
    }

    public static SET_TEL nullSET_TEL()
    {
        return new SET_TELImpl(((CS) (null)));
    }

    protected SET_TELImpl(TEL atel[])
    {
        if(atel == null)
            throw ANYImpl.newNullException("SET<TEL>", "constructor", "elements");
        for(int i = 0; i < atel.length; i++)
            if(atel[i] != null && atel[i].isNull().isFalse())
                mSet.add(atel[i]);

    }

    protected SET_TELImpl(TEL tel)
    {
        if(tel == null || tel.isNull().isTrue())
        {
            throw ANYImpl.newNullException("SET<TEL>", "constructor", "element");
        } else
        {
            mSet.add(tel);
            return;
        }
    }

    public SET_TELImpl(Set set)
    {
        super(set);
    }

    public SET_TELImpl(CS cs)
    {
        super(cs);
    }

    public BL equal(ANY any)
    {
        if(!(any instanceof SET_TEL))
            return BLImpl.FALSE;
        if(isNull().or(any.isNull()).isTrue())
        {
            return BLImpl.FALSE;
        } else
        {
            SET_TEL set_tel = (SET_TEL)any;
            return BLImpl.valueOf(equalsSet(set_tel.toSet()));
        }
    }

    public TYPE dataType()
    {
        return com.sunwayhorizo.health.hl7.datatypes.common.TYPEImpl.SET_TEL;
    }

    protected boolean verifyItem(Object obj)
    {
        return (obj instanceof TEL) && ((TEL)obj).nonNull().isTrue();
    }

    public int hashCode()
    {
        return super.hashCode();
    }

    public static SET_TEL nullSET_TEL(CS cs)
    {
        String s = null;
        if(cs == null || cs.literal().stringValue() == null || cs.isNull().isTrue())
            s = "NI";
        else
            s = cs.literal().stringValue();
        if(s.equals("NI"))
            return nullNI;
        if(s.equals("OTH"))
            return nullOTH;
        if(s.equals("NINF"))
            return nullNINF;
        if(s.equals("PINF"))
            return nullPINF;
        if(s.equals("UNK"))
            return nullUNK;
        if(s.equals("ASKU"))
            return nullASKU;
        if(s.equals("NAV"))
            return nullNAV;
        if(s.equals("MSK"))
            return nullMSK;
        if(s.equals("NA"))
            return nullNA;
        if(s.equals("NASK"))
            return nullNASK;
        else
            return nullNI;
    }

}
